package com.example.mongodb.mongodb.controller.rabbitmq.zhifu;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;


@Component
public class ZhiFuListener    {


    @RabbitListener(queues = "siXinQueue")
    public void listenerQueue(Message message, Channel channel) throws IOException {
        System.out.println("接收到的消息为："+new String(message.getBody()));
        long deliveryTag = message.getMessageProperties().getDeliveryTag();
        System.out.println(deliveryTag);
        channel.basicAck(deliveryTag,false);
    }
}
